import * as types from './types'
export function todoReducer(state={
  list:['gstgsdfgsdgfsdfgsdgsdfg']
},option){
  switch (option.type) {
    case types.TODO_REMOVE:
      // state.list.splice(option.data,1)
      return {
        ...state,
        list:state.list.filter((item,index)=>index!==option.data)
      }
    case types.TODO_ADD:
      // state.list.push(option.data)
      return {
        ...state,
        list:state.list.concat(option.data)
      }
  
    default:
      return {
        ...state
      }
      break;
  }
}
export function  colorReducer(state={
  color:'red'
},option){
  switch (option.type) {
    case types.CHNANGE_COLOR:
      return {
        ...state,
        color:option.col
      }
  
    default:
      return {
        ...state
      }
      break;
  }
}